<%@page import="com.zretc.news.entity.NewsType"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>用户列表</title>

<!--1. Bootstrap core CSS -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<!--2. Custom styles for this template -->
<link href="css/dashboard.css" rel="stylesheet">

</head>
<body>
	<jsp:include page="nav.html"></jsp:include>
<%=request==>HttpServletRequest %>
	<div class="container-fluid">
		<div class="row">
			<div class="col-sm-3 col-md-2 sidebar">
				<ul class="nav nav-sidebar">
					<li><a href="NewsTypeServlet">新闻类型表 <span class="sr-only">(current)</span></a></li>
					<li><a href="addtype.jsp">新增类型</a></li>
					<li class="active"><a href="UsersServlet">用户列表</a></li>
					<li><a href="addusers.jsp">新增用户</a></li>
				</ul>

			</div>
			<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
				<h2 class="sub-header">
					用户列表

					<form class="navbar-form navbar-right" action="UsersServlet"
						method="post">
						<input type="text" class="form-control" name="keywords"
							placeholder="关键字"> <input type="submit"
							class="btn btn-primary" value="查询">
					</form>

				</h2>
				<div class="table-responsive">
					<table class="table table-striped">
						<thead>
							<tr>
								<th>编号</th>
								<th>用户名</th>
								<th>用户状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<!-- 如果属性范围内的list为null，我们就跳转到NewsTypeServlet去获取数据，然后再转发回来 -->
							<c:if test="${list==null}">
								<!-- c:redirect 跳转到 NewsTypeServlet -->
								<c:redirect url="UsersServlet"></c:redirect>
							</c:if>
							<!-- 如果 范围内的list不为空，遍历数据并展示结果 -->
							<c:if test="${list!=null}">
								<c:forEach items="${list}" var="user">
									<tr>
										<td>${user.userid}</td>
										<td>${user.username}</td>
										<td>${user.userstatus==1?"启用":"禁用"}</td>
										<td><a href="#">修改</a> | <a href="#">启用/禁用</a> | <a href="#">重置密码</a></td>

									</tr>
								</c:forEach>
							</c:if>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>

	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!--3 - js/jquery-2.0.3.js -->
	<script src="js/jquery-2.0.3.js"></script>
	<!--4 - ootstrap.min.js -->
	<script src="dist/js/bootstrap.min.js"></script>

</body>
</html>
